package com.cs.cssupplier.service.impl;


import com.cs.cssupplier.domain.CsAccess;
import com.cs.cssupplier.service.CsAccessService;
import com.cs.cssupplier.mapper.CsAccessMapper;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.utils.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
* @author admin
* @description 针对表【cs_access(供应商准入)】的数据库操作Service实现
* @createDate 2024-11-11 16:40:47
*/
@Service
public class CsAccessServiceImpl implements CsAccessService{
    @Resource
    private CsAccessMapper mapper;

    @Override
    public CsAccess selectCsAccessZrid(Long zrid) {
        return mapper.selectCsAccessZrid(zrid);
    }

    @Override
    public List<CsAccess> selectAccessList(CsAccess csAccess) {
        return mapper.selectAccessList(csAccess);
    }

    @Override
    public int addAccess(CsAccess csAccess) {
        return mapper.addAccess(csAccess);
    }

    @Override
    public int updateAccess(CsAccess csAccess) {
        return mapper.updateAccess(csAccess);
    }

    @Override
    public int deleteAccess(Long zrid) {
        return mapper.deleteAccess(zrid);
    }

    @Override
    public int deleteListAccess(Long[] zrids) {
        return mapper.deleteListAccess(zrids);
    }

    @Override
    public boolean checkConfigAccess(CsAccess csAccess) {
        Long confId = StringUtils.isNull(csAccess.getZr_id())?-1L:csAccess.getZr_id();
        CsAccess info=mapper.checkConfigAccess(csAccess.getZr_bnumber());
        if (StringUtils.isNotNull(info) && info.getZr_id().longValue() !=confId.longValue()){
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
    }


}




